package com.example.socket.factory;

import com.example.proxy.MethodProxy;
import com.example.socket.model.ServletModel;

import java.util.HashMap;
import java.util.Map;

/**
 * @Classname ServerModelFactory
 * @Description TODO
 * @Date 2023/4/28 14:46
 * @Created by XiongXiong
 * @Author: X.I.O
 */
public class ServerModelFactory {

    public static Map<String,ServletModel> getServletModelByFactory(Map<String,MethodProxy> methodProxy){
        Map<String,ServletModel> servletModelMap=new HashMap<>();
        for (Map.Entry<String, MethodProxy> entry : methodProxy.entrySet()) {
            ServletModel servletModel=new ServletModel(entry.getValue(),entry.getValue().getRequestMethod());
            servletModelMap.put(entry.getKey(), servletModel);
        }
        return servletModelMap;
    }
}
